package com.dfec.book.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dfec.book.util.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.time.LocalDateTime;


/**
 * 图书实体类
 *
 * @author tangrg
 * @email 1446232546@qq.com
 * @date 2025-06-2025/6/18 10:32:11
 */
@ApiModel(description = "图书实体")
@TableName("book")
public class BookEntity extends BasePage {

    @ApiModelProperty(value = "图书ID（主键，自增）", example = "1001")
    @TableId
    private Integer bookId;

    @ApiModelProperty(value = "图书名称", example = "Java编程思想", required = true)
    private String bookName;

    @ApiModelProperty(value = "作者姓名", example = "Bruce Eckel", required = true)
    private String author;

    @ApiModelProperty(value = "出版社名称", example = "机械工业出版社")
    private String publisher;

    @ApiModelProperty(value = "所属类别ID", example = "1", required = true)
    private Integer categoryId;

    @ApiModelProperty(value = "是否借出", example = "false")
    private Boolean isBorrowed;

    @ApiModelProperty(value = "创建时间", example = "2023-05-01T10:00:00")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间", example = "2023-05-15T15:30:00")
    private LocalDateTime updateTime;


    @ApiModelProperty(value = "所属类别详细信息")
    @TableField(exist = false)
    private BookCategoryEntity category;

    // 构造方法
    public BookEntity() {
        this.isBorrowed = false;
        this.createTime = LocalDateTime.now();
    }

    // Getter和Setter方法
    public Integer getBookId() {
        return bookId;
    }

    public void setBookId(Integer bookId) {
        this.bookId = bookId;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    public Integer getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }

    public Boolean getIsBorrowed() {
        return isBorrowed;
    }

    public void setIsBorrowed(Boolean borrowed) {
        isBorrowed = borrowed;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public BookCategoryEntity getCategory() {
        return category;
    }

    public void setCategory(BookCategoryEntity category) {
        this.category = category;
    }

    @Override
    public String toString() {
        return "BookEntity{" +
                "bookId=" + bookId +
                ", bookName='" + bookName + '\'' +
                ", author='" + author + '\'' +
                ", publisher='" + publisher + '\'' +
                ", categoryId=" + categoryId +
                ", isBorrowed=" + isBorrowed +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
}
